<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{article.title}}</title>
    <link href="/static/lib/layui-v2.5.5/css/layui.css" rel="stylesheet">
    <link href="/static/editor/css/editormd.css" rel="stylesheet">
    <script type="text/javascript" src="/static/js/up/jquery.js"></script>
    <script src="/static/editor/editormd.min.js"></script>
    <script src="/static/lib/layui-v2.5.5/layui.js"></script>
</head>
<body style="padding-top:10px;">
<form class="layui-form" action="/updateArticle/" method="post">{% csrf_token %}
    <div class="layui-form-item">
        <div class="layui-inline">
          <input type="hidden" name="id" value="{{article.id}}">
          <label class="layui-form-label">标题</label>
          <div class="layui-input-inline">
            <input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input" value="{{article.title}}">
          </div>
        </div>
        <div class="layui-inline">
              <label class="layui-form-label">分类</label>
              <div class="layui-input-inline">
                <select name="category" lay-filter="aihao">
                    <option value="">{{article.category}}</option>
                </select>
              </div>
            </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label">标签</label>
          <div class="layui-input-inline">
            <select name="tags" lay-filter="aihao">
                <option value="">{{article.tags}}</option>
            </select>
          </div>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label">作者</label>
          <div class="layui-input-inline">
            <input type="text" name="user" placeholder="请输入作者" autocomplete="off" class="layui-input" value="{{ user.username }}">
          </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">摘要</label>
        <div class="layui-input-block">
          <textarea name="intro" placeholder="请输入摘要" class="layui-textarea" >{{article.intro}}</textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            <div id="editormd">
                <textarea  name="body">{{article.body}}</textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
          <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function() {
        var editor = editormd("editormd", {
            width : "100%",
            height : 500,
            syncScrolling : "single",
            path : "/static/editor/lib/"
        });
    });
    layui.use('form', function() {
			var form = layui.form;
			form.render('select');
		});
	var info='{{info}}';
		if(info=='ok'){
			layui.use('layer', function(){
				  var layer = layui.layer;
				  layer.alert('更新成功')
				});

		}
		if(info=='fail'){
			layui.use('layer', function(){
				  var layer = layui.layer;
				  layer.alert("更新失败");
				});

		}
</script>
</body>
</html>